<!DOCTYPE html> 
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>guanlizhe</title> 
<style>
#header {
	background-color:black;
	color:white;
	text-align:center;
    padding:1px;}
#foot {
	background-color:black;
	color:white;
	text-align:center;
    padding:20px;
	clear:both;
}
#footon {
	background-color:white;
	color:black;
	text-align:center;
    padding:5px;
	clear:both;
}
.city {
	background-color:yellow;
    float: left;
    margin: 5px;
    padding: 15px;
    width: 384px;
    height: 280px;
    border: 2px solid black;
	text-align:center;
} 
</style>
</head>
<body>	
<?php
header('Content-type:text/html;charset=utf-8');
include_once("../class/mysqlclass.php");
session_start();
$_SESSION['act']='guanlizhe';
$getid=$_GET['id'];
//判断进入管理者哪个系统
if(preg_match('/yh/', $getid)){
	$s=1;
	preg_match('/[0-9]+/', $getid,$k);
	echo '<div id="header"><h1>用户系统</h1>';
	echo "<hr/><h3><a href='./deleteone.php?id=yonghuall'>全部删除</a></h3></div>";
	$mysqli = new test;
	$mysqli = $mysqli -> Con();
    $sql = "select * from `user`";
}
if(preg_match('/wz/', $getid)){
	$s=2;
	preg_match('/[0-9]+/', $getid,$k);
	echo '<div id="header"><h1>文章系统</h1>';
	echo "<hr/><h3><a href='./deleteone.php?id=wenzhangall'>全部删除</a></h3></div>";
	$mysqli = new writing;
	$mysqli = $mysqli -> Con();
    $sql = "select * from `write`";	
}
$getid=$k[0];
$res=$mysqli->query($sql);
$wzs=0;
$id= 0;
foreach($res as $var){
	$id=$id + 1;
	$wzs++;
	if($id>($getid-1)*3){
		echo '<div class="city">';
		if($s==2){
			echo '标题：'.$var['title'].'<br>';
			echo '作者：'.$var['author'].'<br>';
			$pdo=new my();
			echo '简介：'.$pdo->Limit($var['description'],20).'<br>';
			echo '内容：'.$pdo->Limit($var['content'],200).'<br>';
			echo '<a href="./deleteone.php?id=wz'.$var['id'].'">删除</a>';
		}else{
			if($s==1){
				echo '用户名：'.$var['username'].'<br>';
				echo '密码：'.$var['password'].'<br>';
				echo '手机号：'.$var['telephone'].'<br>';
				echo '年龄：'.$var['age'].'<br>';
				echo '头像:';
				$pdo=new my();
				echo $pdo->ShowPhoto($var['username']).'<br>';
				echo '<a href="./deleteone.php?id=yh'.$var['id'].'">删除</a>';		
			}
		}
		echo '</div>';
		if($id==$getid*3){
			break;
		}
	}
}

for(;$id<$getid*3;$id++){
	echo '<div class="city"><p style="color:red">该区域空空如也</p></div>';
}	
//分页
echo '<div id="footon"><hr/><p>页码：';
if($wzs%3!=0){
	$yema=($wzs-$wzs%3)/3+1;
}else{
	$yema= $wzs/3;
 }
for($i=1;$i<=$yema;$i++){
	if($s==1){
		echo '<a href="manager.php?id=yh'.$i.'">'.$i.'</a>';
	}else{
		echo '<a href="manager.php?id=wz'.$i.'">'.$i.'</a>';
	}
	echo ' ';
}
echo '</p></div>';
if($id == 0){
	echo '很抱歉，没有查询到信息!';
}
?>
<div id="foot"><h2><a href="./managementsystem.php?act=back">返回管理系统</a></h2></div>
</body>
</html>